Skip to content

Fix PowerShell 5.1 compatibility in New-HelpCabinetFile#843

Merged
adityapatwardhan merged 3 commits into
PowerShell:mainfrom
kborowinski:fix-new-helpcabinetfile
Jul 8, 2026
Merged

Fix PowerShell 5.1 compatibility in New-HelpCabinetFile#843
adityapatwardhan merged 3 commits into
PowerShell:mainfrom
kborowinski:fix-new-helpcabinetfile

Conversation

@kborowinski

@kborowinski kborowinski commented May 7, 2026

Copy link
Copy Markdown
Contributor

PR Summary

Fixes #842 New-HelpCabinetFile so it can run on Windows PowerShell 5.1 by avoiding unconditional use of the $IsWindows automatic variable

$IsWindows is available in PowerShell Core, but it is not defined in Windows PowerShell 5.1. The updated check only evaluates $IsWindows when $PSEdition is Core, while preserving the existing behavior that blocks this cmdlet on non-Windows platforms.

PR Context

New-HelpCabinetFile is a Windows-only cmdlet, but the previous platform check could fail on Windows PowerShell 5.1 because $IsWindows does not exist there.

This change allows the cmdlet to continue working on Windows PowerShell 5.1 while still throwing the existing unsupported-platform error when running PowerShell Core on non-Windows systems.


This change is Reviewable

@adityapatwardhan

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@sdwheeler sdwheeler left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adityapatwardhan

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@adityapatwardhan adityapatwardhan merged commit 9a124fb into PowerShell:main Jul 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New-HelpCabinetFile fails on Windows PowerShell 5.1 because $IsWindows is undefined

3 participants